#pragma once

#include"../redis/campus_redis_connector.h"

const std::string CAMPUS_REDIS_KEY_ONLINE = "campus:user:oneline";

enum CampusLoginRedisClientRet{
    CAMPUS_LOGIN_REDIS_CLIENT_RET_SUCCESS,
    CAMPUS_LOGIN_REDIS_CLIENT_RET_FAIL,
    CAMPUS_LOGIN_REDIS_CLIENT_RET_NOT_EXIST,
    CAMPUS_LOGIN_REDIS_CLIENT_RET_EXIST
};


class CampusLoginRedisClient : public CampusRedisConnector
{
public:
    CampusLoginRedisClient(std::string const& redis_url,int redis_port,int timeout_ms);
    virtual ~CampusLoginRedisClient();

    enum CampusLoginRedisClientRet setUserOnline(std::string const& uid,int expired_ms);
    enum CampusLoginRedisClientRet delUserOnline(std::string const& uid);
    enum CampusLoginRedisClientRet existUserOnline(std::string const& uid);

private:
    std::string constructKey(std::string const& prefix,std::string const& suffix);

private:
};